﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BussinesCosea;
using System.Configuration;

public partial class AvancedeOrden : System.Web.UI.Page
{
    private static AppSettingsReader settings = new AppSettingsReader();
    string cadena = (string)settings.GetValue("Conexion2", typeof(string));
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnBuscar_Click(object sender, EventArgs e)
    {
        cargaGrid();
    }

    private void cargaGrid()
    {
        string criterio = "";
        criterio = CampoBuscar.Text.Trim();
        using (BussinesCosea.CoseaDirectos c = new BussinesCosea.CoseaDirectos(cadena))
        {
            grdDatos.DataSource = c.BuscaOrdenServicio(criterio);
            grdDatos.DataBind();
        }
    }


    protected void grdDatos_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdDatos.PageIndex = e.NewPageIndex;
        cargaGrid();
    }

    protected void grdDatos_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect("ResultadoOser.aspx?id=" + grdDatos.SelectedValue.ToString());
        //Response.Redirect("ResultadoOser.aspx");
    }




}